package com.ysg.widget.dialog;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.view.Window;

import com.ysg.R;
import com.ysg.base.BaseDialog;

/**
 * 底部 分享
 */
public class ShareDialog extends BaseDialog {
    public interface OnShareListener{
        void onWechatClick();
        void onWechatFriendsClick();
        void onQQClick();
        void onQrcodeClick();
    }
    private OnShareListener listener;
    public void setOnShareListener(OnShareListener listener){
        this.listener = listener;
    }


    private View tvWechat, tvWechatFriends, tvQQ, tvQrcode;
    public ShareDialog(Context context) {
        super(context);
    }

    @Override
    public int getLayoutId() {
        return R.layout.dialog_share;
    }

    public void initView() {
        setWidthScale(0.95f);
        Window window = getWindow();
        window.setGravity(Gravity.BOTTOM);

        tvWechat = findViewById(R.id.tvWechat);
        tvWechatFriends = findViewById(R.id.tvWechatFriends);
        tvQQ = findViewById(R.id.tvQQ);
        tvQrcode = findViewById(R.id.tvQrcode);
    }

    @Override
    public void initData() {
    }

    @Override
    public void initListener() {
        tvWechat.setOnClickListener((v -> {
            dismiss();
            if (listener != null){
                listener.onWechatClick();
            }
        }));
        tvWechatFriends.setOnClickListener((v -> {
            dismiss();
            if (listener != null){
                listener.onWechatFriendsClick();
            }
        }));
        tvQQ.setOnClickListener((v -> {
            dismiss();
            if (listener != null){
                listener.onQQClick();
            }
        }));
        tvQrcode.setOnClickListener((v -> {
            dismiss();
            if (listener != null){
                listener.onQrcodeClick();
            }
        }));

    }


}
